package com.xuzimian.globaldemo.spring.springsecurity.service;

import com.xuzimian.globaldemo.spring.springsecurity.domain.Spittle;
import org.springframework.security.access.prepost.PreAuthorize;

public class ExpressionSecuredSpittleService implements SpittleService {

  @Override
  @PreAuthorize("(hasRole('ROLE_SPITTER') and #spittle.text.length() <= 8) or hasRole('ROLE_PREMIUM')")
  public void addSpittle(Spittle spittle) {
    System.out.println(spittle.getText());
    System.out.println("Method was called successfully");
  }
  
}
